#pragma once

#include <iostream>
#include <time.h>
#include <string>
#include "./util.hpp"

namespace ns_log
{
    using namespace ns_util;

    /*日志等级*/
    enum
    {
        INFO,
        DEBUG,
        WARNING,
        ERROR,
        FATAL
    };
    std::ostream &log(const std::string &level, const std::string &filename, int line)
    {
        std::string message;
        /*日志等级*/
        message += "[";
        message += level;
        message += "]";
        /*报错文件名称*/
        message += "[";
        message += filename;
        message += "]";
        /*报错行*/
        message += "[";
        message += std::to_string(line);
        message += "]";
        /*日志时间*/
        message += "[";
        message += time_util::get_time(2);
        message += "]";

        std::cout << message;
        return std::cout;
    }
/*宏调用接口*/
#define LOG(level) log(#level, __FILE__, __LINE__)

}
